package com.heima.wemedia.controller.v1;

import com.heima.api.wemedia.LoginControllerApi;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmUserDto;
import com.heima.model.wemedia.pojos.WmUser;
import com.heima.wemedia.service.WmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class LoginController implements LoginControllerApi {

    @Autowired
    WmUserService wmUserService;

    /**
     * 登录
     *
     * @param wmUserDto
     * @return
     */
    @Override
    @PostMapping("/in")
    public ResponseResult login(@RequestBody WmUserDto wmUserDto) {
        return wmUserService.login(wmUserDto);
    }

    /**
     * 注册
     *
     * @param wmUser
     * @return
     */
    @Override
    @PostMapping("/regist")
    public ResponseResult regist(@RequestBody WmUser wmUser) {
        return wmUserService.regist(wmUser);
    }
}
